package com.dragon.repository.domain.vo;

import com.dragon.common.model.Update;
import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.ToSend;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@ApiModel(value = "")
public class ToSendVO {

    private static final long serialVersionUID = 1L;

    private Integer id;

    @ApiModelProperty(value = "流程类型")
    private Integer streamType;

    @ApiModelProperty(value = "关联主表id")
    private Integer correlationId;

    @ApiModelProperty(value = "0发起抄送，1审核抄送")
    private Integer examineType;

    @ApiModelProperty(value = "抄送人")
    private Integer toAdmin;

    @ApiModelProperty(value = "抄送时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;


    @NotNull(groups = Update.class,message = "主键不能为空")
    public static ToSend convert(ToSendVO vo) {
        ToSend entity = new ToSend();
        BeanUtils.copyProperties(vo,entity);
        return entity;
    }
    public static List<ToSend> convertList(List<ToSendVO> list) {
        List<ToSend> resultList = new ArrayList<>();
        for (ToSendVO vo : list) {
            resultList.add(convert(vo));
        }
        return resultList;
    }
}
